                ;MASTER CATALOG UPDATE - UCAT.ASM
                ;01/07/78 BY WARD CHRISTENSEN
                ;01/10/78 ADD:
                ;		(RUN UCAT)
                ;		ERA MAST.BAK
                ;		REN MAST.BAK=MAST.CAT
                ;		REN MAST.CAT=NEW.CAT
                ;		ERA NAMES.SUB
                ; 4 SEPT 80 MODIFIED BY TREVOR MARSHALL
                ;			UNI W A
                ;			DEPT ELEC ENG
                ;  UPDATES ON TUG DISCS ADDED,
                ;  WILDCARD IGNORE CAPABILITY
 0100           	ORG	100H
 1400 =         BSIZE	EQU	1400H	;DK BUF SIZE (TIMES 3)
                ; BSIZE WAS 1000H ORIGINALLY
 0400 =         IGNSIZE	EQU	1024	;BUFF FOR IGNORED NAMES
 0000 =         TEST	EQU	0	;TESTING?
                	MACLIB	SEQIO
 07F6 #         FILERR	SET	EXIT	;EXIT IF ERRORS
                MOVE	MACRO	?F,?T,?L
                	MVI	B,?L
                	LXI	D,?F
                	LXI	H,?T
                	CALL	MOVER
                	ENDM
                COMPARE	MACRO	?F1,?F2,?L
                	MVI	B,?L
                	LXI	D,?F1
                	LXI	H,?F2
                	CALL	COMPR
                	ENDM
                ;
                ;SAVE CP/M'S STACK
                ;
 0100 E1        	POP	H	;GET CP/M RET ADDR
 0101 22F707    	SHLD	EXIT+1	;SAVE IN EXIT JMP
 0104 312B08    	LXI	SP,STACK
                	FILE	INFILE,MASTIN,,MAST,CAT,BSIZE
 0001+=         MASTINTYP	EQU	INFILE
 0107+C33101    	JMP	??0008
 010A+00        	DB	0
 010B+4D        	DB	'M'
 010C+41        	DB	'A'
 010D+53        	DB	'S'
 010E+54        	DB	'T'
 010F+20        	DB	' '
 0110+20        	DB	' '
 0111+20        	DB	' '
 0112+20        	DB	' '
 0113+43        	DB	'C'
 0114+41        	DB	'A'
 0115+54        	DB	'T'
 010A+=         FCBMASTIN	EQU	$-12
 0116+00        	DB	0
 0117+          	DS	20
 012B+850C      	DW	MASTINBUF
 1400+=         MASTINSIZ	EQU	@BS
 012D+0014      	DW	@BS
 012F+          	DS	2
 0131+C3A101    	JMP	??0001
 0134+2A2D01    	LHLD	MASTINLEN
 0137+EB        	XCHG
 0138+2A2F01    	LHLD	MASTINPTR
 013B+7D        	MOV	A,L
 013C+93        	SUB	E
 013D+7C        	MOV	A,H
 013E+9A        	SBB	D
 013F+DA8A01    	JC	??0007
 0142+210000    	LXI	H,0
 0145+222F01    	SHLD	MASTINPTR
 0148+EB        	XCHG
 0149+2A2D01    	LHLD	MASTINLEN
 014C+7B        	MOV	A,E
 014D+95        	SUB	L
 014E+7A        	MOV	A,D
 014F+9C        	SBB	H
 0150+D27C01    	JNC	??0006
 0153+2A2B01    	LHLD	MASTINADR
 0156+19        	DAD	D
 0157+EB        	XCHG
 0158+0E1A      	MVI	C,@DMA
 015A+CD0500    	CALL	@BDOS
 015D+110A01    	LXI	D,FCBMASTIN
 0160+0E14      	MVI	C,@FRD
 0162+CD0500    	CALL	@BDOS
 0165+B7        	ORA	A
 0166+C27601    	JNZ	??0005
 0169+118000    	LXI	D,@SECT
 016C+2A2F01    	LHLD	MASTINPTR
 016F+19        	DAD	D
 0170+222F01    	SHLD	MASTINPTR
 0173+C34801    	JMP	??0004
 0176+2A2F01    	LHLD	MASTINPTR
 0179+222D01    	SHLD	MASTINLEN
 017C+118000    	LXI	D,@TBUF
 017F+0E1A      	MVI	C,@DMA
 0181+CD0500    	CALL	@BDOS
 0184+210000    	LXI	H,0
 0187+222F01    	SHLD	MASTINPTR
 018A+EB        	XCHG
 018B+2A2B01    	LHLD	MASTINADR
 018E+19        	DAD	D
 018F+EB        	XCHG
 0190+2A2D01    	LHLD	MASTINLEN
 0193+7D        	MOV	A,L
 0194+B4        	ORA	H
 0195+3E1A      	MVI	A,EOF
 0197+C8        	RZ
 0198+1A        	LDAX	D
 0199+2A2F01    	LHLD	MASTINPTR
 019C+23        	INX	H
 019D+222F01    	SHLD	MASTINPTR
 01A0+C9        	RET
 01A1+AF        	XRA	A
 01A2+321601    	STA	FCBMASTIN+12
 01A5+322A01    	STA	FCBMASTIN+32
 01A8+210014    	LXI	H,MASTINSIZ
 01AB+222D01    	SHLD	MASTINLEN
 01AE+222F01    	SHLD	MASTINPTR
 01B1+0E0F      	MVI	C,@OPN
 01B3+110A01    	LXI	D,FCBMASTIN
 01B6+CD0500    	CALL	@BDOS
 01B9+3C        	INR	A
 01BA+C2D901    	JNZ	??0003
 01BD+0E09      	MVI	C,@MSG
 01BF+11C801    	LXI	D,??0002
 01C2+CD0500    	CALL	@BDOS
 01C5+C3F607    	JMP	FILERR
 01C8+0D0A      ??0002:	DB	CR,LF
 01CA+4E4F204D41	DB	'NO MASTIN FILE'
 01D8+24        	DB	'$'
                	FILE	INFILE,NAMES,,NAMES,SUB,BSIZE
 0001+=         NAMESTYP	EQU	INFILE
 01D9+C30302    	JMP	??0016
 01DC+00        	DB	0
 01DD+4E        	DB	'N'
 01DE+41        	DB	'A'
 01DF+4D        	DB	'M'
 01E0+45        	DB	'E'
 01E1+53        	DB	'S'
 01E2+20        	DB	' '
 01E3+20        	DB	' '
 01E4+20        	DB	' '
 01E5+53        	DB	'S'
 01E6+55        	DB	'U'
 01E7+42        	DB	'B'
 01DC+=         FCBNAMES	EQU	$-12
 01E8+00        	DB	0
 01E9+          	DS	20
 01FD+8520      	DW	NAMESBUF
 1400+=         NAMESSIZ	EQU	@BS
 01FF+0014      	DW	@BS
 0201+          	DS	2
 0203+C37302    	JMP	??0009
 0206+2AFF01    	LHLD	NAMESLEN
 0209+EB        	XCHG
 020A+2A0102    	LHLD	NAMESPTR
 020D+7D        	MOV	A,L
 020E+93        	SUB	E
 020F+7C        	MOV	A,H
 0210+9A        	SBB	D
 0211+DA5C02    	JC	??0015
 0214+210000    	LXI	H,0
 0217+220102    	SHLD	NAMESPTR
 021A+EB        	XCHG
 021B+2AFF01    	LHLD	NAMESLEN
 021E+7B        	MOV	A,E
 021F+95        	SUB	L
 0220+7A        	MOV	A,D
 0221+9C        	SBB	H
 0222+D24E02    	JNC	??0014
 0225+2AFD01    	LHLD	NAMESADR
 0228+19        	DAD	D
 0229+EB        	XCHG
 022A+0E1A      	MVI	C,@DMA
 022C+CD0500    	CALL	@BDOS
 022F+11DC01    	LXI	D,FCBNAMES
 0232+0E14      	MVI	C,@FRD
 0234+CD0500    	CALL	@BDOS
 0237+B7        	ORA	A
 0238+C24802    	JNZ	??0013
 023B+118000    	LXI	D,@SECT
 023E+2A0102    	LHLD	NAMESPTR
 0241+19        	DAD	D
 0242+220102    	SHLD	NAMESPTR
 0245+C31A02    	JMP	??0012
 0248+2A0102    	LHLD	NAMESPTR
 024B+22FF01    	SHLD	NAMESLEN
 024E+118000    	LXI	D,@TBUF
 0251+0E1A      	MVI	C,@DMA
 0253+CD0500    	CALL	@BDOS
 0256+210000    	LXI	H,0
 0259+220102    	SHLD	NAMESPTR
 025C+EB        	XCHG
 025D+2AFD01    	LHLD	NAMESADR
 0260+19        	DAD	D
 0261+EB        	XCHG
 0262+2AFF01    	LHLD	NAMESLEN
 0265+7D        	MOV	A,L
 0266+B4        	ORA	H
 0267+3E1A      	MVI	A,EOF
 0269+C8        	RZ
 026A+1A        	LDAX	D
 026B+2A0102    	LHLD	NAMESPTR
 026E+23        	INX	H
 026F+220102    	SHLD	NAMESPTR
 0272+C9        	RET
 0273+AF        	XRA	A
 0274+32E801    	STA	FCBNAMES+12
 0277+32FC01    	STA	FCBNAMES+32
 027A+210014    	LXI	H,NAMESSIZ
 027D+22FF01    	SHLD	NAMESLEN
 0280+220102    	SHLD	NAMESPTR
 0283+0E0F      	MVI	C,@OPN
 0285+11DC01    	LXI	D,FCBNAMES
 0288+CD0500    	CALL	@BDOS
 028B+3C        	INR	A
 028C+C2AA02    	JNZ	??0011
 028F+0E09      	MVI	C,@MSG
 0291+119A02    	LXI	D,??0010
 0294+CD0500    	CALL	@BDOS
 0297+C3F607    	JMP	FILERR
 029A+0D0A      ??0010:	DB	CR,LF
 029C+4E4F204E41	DB	'NO NAMES FILE'
 02A9+24        	DB	'$'
                	IF	NOT TEST
                	FILE	OUTFILE,MASTOUT,,NEW,CAT,BSIZE
 0002+=         MASTOUTTYP	EQU	OUTFILE
 02AA+C3D402    	JMP	??0024
 02AD+00        	DB	0
 02AE+4E        	DB	'N'
 02AF+45        	DB	'E'
 02B0+57        	DB	'W'
 02B1+20        	DB	' '
 02B2+20        	DB	' '
 02B3+20        	DB	' '
 02B4+20        	DB	' '
 02B5+20        	DB	' '
 02B6+43        	DB	'C'
 02B7+41        	DB	'A'
 02B8+54        	DB	'T'
 02AD+=         FCBMASTOUT	EQU	$-12
 02B9+00        	DB	0
 02BA+          	DS	20
 02CE+8534      	DW	MASTOUTBUF
 1400+=         MASTOUTSIZ	EQU	@BS
 02D0+0014      	DW	@BS
 02D2+          	DS	2
 02D4+C35903    	JMP	??0017
 02D7+F5        	PUSH	PSW
 02D8+2AD002    	LHLD	MASTOUTLEN
 02DB+EB        	XCHG
 02DC+2AD202    	LHLD	MASTOUTPTR
 02DF+7D        	MOV	A,L
 02E0+93        	SUB	E
 02E1+7C        	MOV	A,H
 02E2+9A        	SBB	D
 02E3+DA4903    	JC	??0023
 02E6+210000    	LXI	H,0
 02E9+22D202    	SHLD	MASTOUTPTR
 02EC+EB        	XCHG
 02ED+2AD002    	LHLD	MASTOUTLEN
 02F0+7B        	MOV	A,E
 02F1+95        	SUB	L
 02F2+7A        	MOV	A,D
 02F3+9C        	SBB	H
 02F4+D23B03    	JNC	??0022
 02F7+2ACE02    	LHLD	MASTOUTADR
 02FA+19        	DAD	D
 02FB+EB        	XCHG
 02FC+0E1A      	MVI	C,@DMA
 02FE+CD0500    	CALL	@BDOS
 0301+11AD02    	LXI	D,FCBMASTOUT
 0304+0E15      	MVI	C,@FWR
 0306+CD0500    	CALL	@BDOS
 0309+B7        	ORA	A
 030A+C21A03    	JNZ	??0021
 030D+118000    	LXI	D,@SECT
 0310+2AD202    	LHLD	MASTOUTPTR
 0313+19        	DAD	D
 0314+22D202    	SHLD	MASTOUTPTR
 0317+C3EC02    	JMP	??0020
 031A+0E09      	MVI	C,@MSG
 031C+112603    	LXI	D,??0025
 031F+CD0500    	CALL	@BDOS
 0322+F1        	POP	PSW
 0323+C3F607    	JMP	FILERR
 0326+0D0A      ??0025:	DB	CR,LF
 0328+4449534B20	DB	'DISK FULL: MASTOUT'
 033A+24        	DB	'$'
 033B+118000    	LXI	D,@TBUF
 033E+0E1A      	MVI	C,@DMA
 0340+CD0500    	CALL	@BDOS
 0343+210000    	LXI	H,0
 0346+22D202    	SHLD	MASTOUTPTR
 0349+EB        	XCHG
 034A+2ACE02    	LHLD	MASTOUTADR
 034D+19        	DAD	D
 034E+EB        	XCHG
 034F+F1        	POP	PSW
 0350+12        	STAX	D
 0351+2AD202    	LHLD	MASTOUTPTR
 0354+23        	INX	H
 0355+22D202    	SHLD	MASTOUTPTR
 0358+C9        	RET
 0359+AF        	XRA	A
 035A+32B902    	STA	FCBMASTOUT+12
 035D+32CD02    	STA	FCBMASTOUT+32
 0360+210014    	LXI	H,MASTOUTSIZ
 0363+22D002    	SHLD	MASTOUTLEN
 0366+210000    	LXI	H,0
 0369+22D202    	SHLD	MASTOUTPTR
 036C+0E13      	MVI	C,@DEL
 036E+11AD02    	LXI	D,FCBMASTOUT
 0371+CD0500    	CALL	@BDOS
 0374+0E16      	MVI	C,@MAK
 0376+11AD02    	LXI	D,FCBMASTOUT
 0379+CD0500    	CALL	@BDOS
 037C+3C        	INR	A
 037D+C2A303    	JNZ	??0019
 0380+0E09      	MVI	C,@MSG
 0382+118B03    	LXI	D,??0018
 0385+CD0500    	CALL	@BDOS
 0388+C3F607    	JMP	FILERR
 038B+0D0A      ??0018:	DB	CR,LF
 038D+4E4F204449	DB	'NO DIR SPACE: MASTOUT'
 03A2+24        	DB	'$'
                	ENDIF
                	FILE	SETFILE,BAK,,MAST,BAK
 0003+=         BAKTYP	EQU	SETFILE
 03A3+C3C703    	JMP	??0033
 03A6+00        	DB	0
 03A7+4D        	DB	'M'
 03A8+41        	DB	'A'
 03A9+53        	DB	'S'
 03AA+54        	DB	'T'
 03AB+20        	DB	' '
 03AC+20        	DB	' '
 03AD+20        	DB	' '
 03AE+20        	DB	' '
 03AF+42        	DB	'B'
 03B0+41        	DB	'A'
 03B1+4B        	DB	'K'
 03A6+=         FCBBAK	EQU	$-12
 03B2+00        	DB	0
 03B3+          	DS	20
                ;
                ;SETUP THE FILES
                ;
 03C7 CDD105    INITRD	CALL	READNA	;READ NAMES FILE
                ;
                ;IF NAME IS $$$.SUB THEN SKIP IT
                ;
                	COMPARE	NADAT,SUBNAME,12
 03CA+060C      	MVI	B,12
 03CC+112D08    	LXI	D,NADAT
 03CF+217808    	LXI	H,SUBNAME
 03D2+CD4607    	CALL	COMPR
 03D5 CAC703    	JZ	INITRD
                ;
                ;CHECK FOR '-DISKNAME' HAVING BEEN READ
                ;
 03D8 3A2D08    	LDA	NADAT
 03DB FE2D      	CPI	'-'
 03DD CA6204    	JZ	NAMEOK
                ;THE FOLLOWING CODE IS PATCHED VIA DISASSEMBLY
 03E0 3A5D00    	LDA	5DH
 03E3 FE2D      	CPI	'-'
 03E5 C22604    	JNZ	ERRXIT
 03E8 3A6700    	LDA	67H
 03EB FE20      	CPI	' '
 03ED C20D04    	JNZ	NEWSUB
 03F0 CDF007    	CALL	MSGXIT
 03F3 2B2B534552	DB	'++SERIAL MUST'
 0400 2042452033	DB	' BE 3 DIGITS$'
                ;
 040D 0607      NEWSUB	MVI	B,7
 040F 115E00    	LXI	D,5EH
 0412 213A08    	LXI	H,DKNAME
 0415 CD3D07    	CALL	MOVER
 0418 0603      	MVI	B,3
 041A 116500    	LXI	D,65H
 041D 214308    	LXI	H,NEW
 0420 CD3D07    	CALL	MOVER
 0423 C37804    	JMP	NXT1
                ;
 0426 CDF007    ERRXIT	CALL	MSGXIT
 0429 2B2B4E4F20	DB	'++NO "-NAME.NNN" IN NAMES.SUB'
 0446 0D0A2B2B52	DB	0DH,0AH,'++REISSUE: UCAT '
 0458 2D6E616D65	DB	'-name.nnn$'
                ;	CALL	MSGXIT
                ;	DB	'++NO ''-NAME'' IN DIRECTORY$'
                ;
                NAMEOK	MOVE	NADAT+1,DKNAME,7
 0462+0607      	MVI	B,7
 0464+112E08    	LXI	D,NADAT+1
 0467+213A08    	LXI	H,DKNAME
 046A+CD3D07    	CALL	MOVER
                	MOVE	NADAT+9,DKNAME+9,3
 046D+0603      	MVI	B,3
 046F+113608    	LXI	D,NADAT+9
 0472+214308    	LXI	H,DKNAME+9
 0475+CD3D07    	CALL	MOVER
                ;
                ;READ IN THE NAMES TO BE IGNORED (I.E. NOT
                ;CATALOGED).  THEY ARE AT THE FRONT OF MAST CAT.
                ;THEY ARE SIMPLY A LIST OF FILENAME.FILETYPE (CR/LF)
                ;WITH THE FIRST HAVING A ( BEFORE IT, AND THE
                ;LAST HAVING A ) AFTER IT.
                ;
                NXT1	GET	MASTIN	;GET THE LEADING '('
 0478+CD3401    	CALL	GETMASTIN
 047B CACD04    	JZ	NOIGN	;IF EOF
 047E FE28      	CPI	'('
 0480 C2CD04    	JNZ	NOIGN
                	PUT	MASTOUT
 0483+CDD702    	CALL	PUTMASTOUT
 0486 218408    	LXI	H,IGNORE ;POINT TO BUFFER
 0489 010004    	LXI	B,IGNSIZE ;FOR BUFFER OVERFLOW TEST
 048C C5        IGNRD	PUSH	B
 048D E5        	PUSH	H
                	GET	MASTIN
 048E+CD3401    	CALL	GETMASTIN
 0491 CAEE04    	JZ	IGNEOF	;UNEXPECTED EOF
 0494 F5        	PUSH	PSW	;SAVE CHAR
                	PUT	MASTOUT
 0495+CDD702    	CALL	PUTMASTOUT
 0498 F1        	POP	PSW
 0499 E1        	POP	H
 049A C1        	POP	B
 049B 77        	MOV	M,A
 049C 23        	INX	H
 049D FE29      	CPI	')'
 049F CA3405    	JZ	IGNEND	;TABLE IS LOADED
 04A2 0B        	DCX	B	;MORE ROOM IN TABLE?
 04A3 78        	MOV	A,B
 04A4 B1        	ORA	C
 04A5 C28C04    	JNZ	IGNRD
                ;TABLE OVERFLOW
 04A8 CDF007    	CALL	MSGXIT
 04AB 2B2B544F4F	DB	'++TOO MANY IGNORE NAMES FOR TABLE$'
 04CD CDF007    NOIGN	CALL	MSGXIT
 04D0 2B2B4E4F20	DB	'++NO IGNORE NAMES IN MAST.CAT$'
 04EE CDF007    IGNEOF	CALL	MSGXIT
 04F1 2B2B454F46	DB	'++EOF READING FOR IGNORE NAMES.'
 0510 0D0A4D4159	DB	0DH,0AH,'MAY BE MISSING ) AFTER LAST NAME.$'
                IGNEND	GET	MASTIN
 0534+CD3401    	CALL	GETMASTIN
 0537 CAEE04    	JZ	IGNEOF
 053A F5        	PUSH	PSW
                	PUT	MASTOUT
 053B+CDD702    	CALL	PUTMASTOUT
 053E F1        	POP	PSW
 053F FE0A      	CPI	0AH
 0541 C23405    	JNZ	IGNEND	;DELETE CR/LF
 0544 C34A05    	JMP	MASTLP
                ;PRIME THE BUFFERS
                ;
 0547 CDD105    NAMELP	CALL	READNA	;READ NAME INTO NADAT
 054A CD6506    MASTLP	CALL	READMI	;READ MASTER INTO MIDAT
                ;IF EOF ON BOTH FILES, WE ARE ALL DONE
 054D 3A2B08    COMPLP	LDA	NAEOFLG	;NAME FILE EOF?
 0550 B7        	ORA	A
 0551 CA5B05    	JZ	NOTEOF	;..NO
 0554 3A2C08    	LDA	MIEOFLG	;MASTER IN EOF?
 0557 B7        	ORA	A
 0558 C25007    	JNZ	ALLDONE	;YES, THAT'S IT.
                NOTEOF	COMPARE	NADAT,MIDAT,25
 055B+0619      	MVI	B,25
 055D+112D08    	LXI	D,NADAT
 0560+214608    	LXI	H,MIDAT
 0563+CD4607    	CALL	COMPR
 0566 CAC005    	JZ	EQUAL
 0569 DA9D05    	JC	WRITEN
                ;
                ;MASTER IS LOWER - WRITE IT IF FOR ANOTHER DISK
                ;
                	COMPARE	MIDSK,DKNAME,12 ;SAME DISK?
 056C+060C      	MVI	B,12
 056E+115308    	LXI	D,MIDSK
 0571+213A08    	LXI	H,DKNAME
 0574+CD4607    	CALL	COMPR
 0577 CA8B05    	JZ	DELMI	;DELETING MIDAT
                	MOVE	MIDAT,MODAT,25
 057A+0619      	MVI	B,25
 057C+114608    	LXI	D,MIDAT
 057F+215F08    	LXI	H,MODAT
 0582+CD3D07    	CALL	MOVER
 0585 CDCE06    	CALL	WRITEMO
 0588 C34A05    	JMP	MASTLP
                ;
                ;DELETE MASTER IN
                ;
 058B 119705    DELMI	LXI	D,DELMSG
 058E 214608    	LXI	H,MIDAT
 0591 CD0807    	CALL	MESG
 0594 C34A05    	JMP	MASTLP
 0597 44454C3A20DELMSG	DB	'DEL: $'
                ;
                ;NAME IS LOWER - WRITE IT
                ;
                WRITEN	MOVE	NADAT,MODAT,25
 059D+0619      	MVI	B,25
 059F+112D08    	LXI	D,NADAT
 05A2+215F08    	LXI	H,MODAT
 05A5+CD3D07    	CALL	MOVER
 05A8 CDCE06    	CALL	WRITEMO
                ;
                ;PRINT THAT NAME WAS ADDED
                ;
 05AB 11BA05    	LXI	D,ADDMSG
 05AE 212D08    	LXI	H,NADAT
 05B1 CD0807    	CALL	MESG
 05B4 CDD105    	CALL	READNA	;READ NEXT NAME
 05B7 C34D05    	JMP	COMPLP
 05BA 4144443A20ADDMSG	DB	'ADD: $'
                ;
                ;BOTH FILES EQUAL
                ;
                EQUAL	MOVE	MIDAT,MODAT,25
 05C0+0619      	MVI	B,25
 05C2+114608    	LXI	D,MIDAT
 05C5+215F08    	LXI	H,MODAT
 05C8+CD3D07    	CALL	MOVER
 05CB CDCE06    	CALL	WRITEMO	;WRITE OUT MASTER
 05CE C34705    	JMP	NAMELP	;READ BOTH
                ;
                ;READ NAME FILE
                ;
 05D1 212D08    READNA	LXI	H,NADAT
 05D4 0608      	MVI	B,8
 05D6 CD1A06    	CALL	READNAC	;READ CHARACTERS
 05D9 362E      	MVI	M,'.'
 05DB 23        	INX	H
 05DC 0603      	MVI	B,3	;TYPE LENGTH
 05DE CD1A06    	CALL	READNAC
 05E1 362C      	MVI	M,','
                ;
                ;IF THIS IS A NAME NOT TO BE CATALOGED,
                ;READ THE NEXT
                ;
 05E3 118408    	LXI	D,IGNORE	;GET IGNORE TABLE
 05E6 212D08    IGNLP	LXI	H,NADAT
 05E9 060C      	MVI	B,12	;# OF CHARS TO MATCH
 05EB 1A        IGNCLP	LDAX	D	;GET IGNORE CHAR INTO A
 05EC FE3F      	CPI	'?'	;IS IT WILDCARD?
 05EE CA0806    	JZ	IGNMAT	;IF SO, CONSIDER MATCHED
 05F1 BE        	CMP	M	;IS IT THE SAME?
 05F2 CA0806    	JZ	IGNMAT	;YES, MATCHED
 05F5 7E        	MOV	A,M	;GET CHAR
 05F6 FE20      	CPI	' '	;SPACE?
 05F8 CA1106    	JZ	IGNMAT1	;MATCH NOT NECESSARY
                ; THE PREVIOUS CODE FAILED WITH AN FCB OF THE FORM DUMMY
                ; (W/O .EXT), AS THE BLANKS WERE NOT REQUIRED TO
                ; MATCH IN THE EXTENSION
                ; FIX: ENSURE THAT IF THE BLANK SKIP PATH IS FOLLOWED
                ;      THAT THE CHARACTER COUNT IS NOT 9
                ;
                ;GET NEXT ENTRY
                ;
 05FB 1A        IGNEXTE	LDAX	D
 05FC 13        	INX	D
 05FD FE29      	CPI	')'	;END OF TABLE?
 05FF C8        	RZ		;..YES, RETURN
 0600 FE0A      	CPI	0AH	;NEXT LINE?
 0602 C2FB05    	JNZ	IGNEXTE
 0605 C3E605    	JMP	IGNLP
                ;
                ;CHAR MATCHED
                ;
 0608 13        IGNMAT	INX	D	;SKIP MATCH CHAR
 0609 23        IGNMAT2	INX	H
 060A 05        	DCR	B
 060B C2EB05    	JNZ	IGNCLP	;LOOP UNTIL DONE
                ;
                ;NAME IS TO BE DELETED
                ;
 060E C3D105    	JMP	READNA	;READ NEXT NAME
                ;
                ; CHECK IF CHARACTER COUNT IS 9 ( .EXT)
 0611 78        IGNMAT1	MOV	A,B	;FETCH COUNT
 0612 FE03      	CPI	3
 0614 CAFB05    	JZ	IGNEXTE ;IF 9, DONT SKIP
 0617 C30906    	JMP	IGNMAT2
                ;
                ;READ CHARACTERS INTO NAME BUFFER
                ;
 061A 3A2B08    READNAC	LDA	NAEOFLG	;EOF ON NAMES?
 061D B7        	ORA	A
 061E C25806    	JNZ	NAEOF	;YES, PAD W/0FFH
 0621 E5        	PUSH	H
 0622 C5        	PUSH	B
                GETNA	GET	NAMES
 0623+CD0602    	CALL	GETNAMES
 0626 FE0A      	CPI	0AH
 0628 CA2306    	JZ	GETNA	;IGNORE LF
 062B C1        	POP	B
 062C E1        	POP	H
 062D FE2E      	CPI	'.'	;END?
 062F CA5006    	JZ	NAEND
 0632 FE0D      	CPI	0DH	;END?
 0634 CA5006    	JZ	NAEND
 0637 FE1A      	CPI	'Z'-40H	;EOF?
 0639 CA5806    	JZ	NAEOF
 063C 77        	MOV	M,A
 063D 23        	INX	H
 063E 05        	DCR	B
 063F C21A06    	JNZ	READNAC
 0642 C5        	PUSH	B
 0643 E5        	PUSH	H
                	GET	NAMES	;KILL DELIMITER CHAR
 0644+CD0602    	CALL	GETNAMES
 0647 E1        	POP	H
 0648 C1        	POP	B
 0649 FE1A      	CPI	'Z'-40H	;EOF?
 064B C0        	RNZ
 064C 322B08    	STA	NAEOFLG
 064F C9        	RET
 0650 3620      NAEND	MVI	M,' '
 0652 23        	INX	H
 0653 05        	DCR	B
 0654 C25006    	JNZ	NAEND
 0657 C9        	RET
 0658 36FF      NAEOF	MVI	M,0FFH
 065A 23        	INX	H
 065B 05        	DCR	B
 065C C25806    	JNZ	NAEOF
 065F 3E01      	MVI	A,1
 0661 322B08    	STA	NAEOFLG
 0664 C9        	RET
                ;
                ;READ MASTER IN NAME
                ;
 0665 214608    READMI	LXI	H,MIDAT
 0668 CD7206    	CALL	MINAME	;GET FILE NAME
 066B 362C      	MVI	M,','	;SEPARATOR
 066D 23        	INX	H
 066E CD7206    	CALL	MINAME	;GET DISK NAME
 0671 C9        	RET
                ;
                ;READ MASTER IN, 1 FIELD
                ;
 0672 0608      MINAME	MVI	B,8
 0674 CD8006    	CALL	READMIC	;GET CHARS
 0677 362E      	MVI	M,'.'
 0679 23        	INX	H
 067A 0603      	MVI	B,3
 067C CD8006    	CALL	READMIC	;GET TYPE
 067F C9        	RET
                ;
                ;READ CHARS INTO MASTER NAME
                ;
 0680 3A2C08    READMIC	LDA	MIEOFLG
 0683 B7        	ORA	A
 0684 C2C306    	JNZ	MIEOF
 0687 E5        	PUSH	H
 0688 C5        	PUSH	B
                GETMI	GET	MASTIN
 0689+CD3401    	CALL	GETMASTIN
 068C FE0A      	CPI	0AH	;IGNORE LF
 068E CA8906    	JZ	GETMI	;L/F'S
 0691 C1        	POP	B
 0692 E1        	POP	H
 0693 FE2C      	CPI	','
 0695 CABB06    	JZ	MIEND
 0698 FE2E      	CPI	'.'
 069A CABB06    	JZ	MIEND
 069D FE0D      	CPI	0DH
 069F CABB06    	JZ	MIEND
 06A2 FE1A      	CPI	'Z'-40H	;EOF?
 06A4 CAC306    	JZ	MIEOF
 06A7 77        	MOV	M,A
 06A8 23        	INX	H
 06A9 05        	DCR	B
 06AA C28006    	JNZ	READMIC
 06AD C5        	PUSH	B
 06AE E5        	PUSH	H
                	GET	MASTIN	;GET DELIMITER
 06AF+CD3401    	CALL	GETMASTIN
 06B2 E1        	POP	H
 06B3 C1        	POP	B
 06B4 FE1A      	CPI	'Z'-40H	;EOF?
 06B6 C0        	RNZ
 06B7 322C08    	STA	MIEOFLG
 06BA C9        	RET
 06BB 3620      MIEND	MVI	M,' '
 06BD 23        	INX	H
 06BE 05        	DCR	B
 06BF C2BB06    	JNZ	MIEND
 06C2 C9        	RET
 06C3 36FF      MIEOF	MVI	M,0FFH
 06C5 23        	INX	H
 06C6 05        	DCR	B
 06C7 C2C306    	JNZ	MIEOF
 06CA 322C08    	STA	MIEOFLG	;SHOW EOF
 06CD C9        	RET
                ;
                ;WRITE AN ENTRY TO MASTER OUT
                ;ALSO BUMP COUNT OF ENTRIES WRITTEN
                ;
 06CE 21E507    WRITEMO	LXI	H,COUNT+3
 06D1 7E        BUMP	MOV	A,M	;GET COUNT DIGIT
 06D2 FE20      	CPI	' '
 06D4 C2D906    	JNZ	BUMPNB
 06D7 3E30      	MVI	A,'0'
 06D9 3C        BUMPNB	INR	A
 06DA 77        	MOV	M,A
 06DB FE3A      	CPI	'9'+1	;TIME TO CARRY?
 06DD C2E606    	JNZ	BUMPD	;..NO, DONE
 06E0 3630      	MVI	M,'0'
 06E2 2B        	DCX	H
 06E3 C3D106    	JMP	BUMP
 06E6 215F08    BUMPD	LXI	H,MODAT
 06E9 0619      	MVI	B,25
 06EB 7E        WRMOL	MOV	A,M
 06EC FE20      	CPI	' '	;NULL CHAR?
 06EE CAF806    	JZ	WRSKIP
 06F1 C5        	PUSH	B
 06F2 E5        	PUSH	H
                	IF	NOT TEST
                	PUT	MASTOUT
 06F3+CDD702    	CALL	PUTMASTOUT
                	ELSE
                	PUT	CON
                	ENDIF
 06F6 E1        	POP	H
 06F7 C1        	POP	B
 06F8 23        WRSKIP	INX	H	;POINT TO NEXT CHAR
 06F9 05        	DCR	B
 06FA C2EB06    	JNZ	WRMOL	;LOOP UNTIL DONE
 06FD 3E0D      	MVI	A,0DH
                	IF	NOT TEST
                	PUT	MASTOUT
 06FF+CDD702    	CALL	PUTMASTOUT
                	ELSE
                	PUT	CON
                	ENDIF
 0702 3E0A      	MVI	A,0AH
                	IF	NOT TEST
                	PUT	MASTOUT
 0704+CDD702    	CALL	PUTMASTOUT
                	ELSE
                	PUT	CON
                	ENDIF
 0707 C9        	RET
                ;
                ;PRINT MESSAGE IN DE, THEN NAME IN HL
                ;
 0708 E5        MESG	PUSH	H
 0709 0E09      	MVI	C,@MSG
 070B CD0500    	CALL	@BDOS
 070E E1        	POP	H
 070F 060C      	MVI	B,12	;NAME + '.' + TYPE
 0711 E5        MESGL	PUSH	H
 0712 C5        	PUSH	B
 0713 7E        	MOV	A,M	;GET CHAR
 0714 FE20      	CPI	' '
 0716 CA2107    	JZ	MESGS	;SKIP IF ' '
                	PUT	CON
 0719+F5        	PUSH	PSW
 071A+0E02      	MVI	C,@CON
 071C+5F        	MOV	E,A
 071D+CD0500    	CALL	@BDOS
 0720+F1        	POP	PSW
 0721 C1        MESGS	POP	B
 0722 E1        	POP	H
 0723 23        	INX	H
 0724 05        	DCR	B
 0725 C21107    	JNZ	MESGL
 0728 3E0D      	MVI	A,0DH
                	PUT	CON
 072A+F5        	PUSH	PSW
 072B+0E02      	MVI	C,@CON
 072D+5F        	MOV	E,A
 072E+CD0500    	CALL	@BDOS
 0731+F1        	POP	PSW
 0732 3E0A      	MVI	A,0AH
                	PUT	CON
 0734+F5        	PUSH	PSW
 0735+0E02      	MVI	C,@CON
 0737+5F        	MOV	E,A
 0738+CD0500    	CALL	@BDOS
 073B+F1        	POP	PSW
 073C C9        	RET
                ;
                ;MOVE SUBROUTINE (DE)=>(HL), LEN IN (B)
                ;
 073D 1A        MOVER	LDAX	D
 073E 77        	MOV	M,A
 073F 13        	INX	D
 0740 23        	INX	H
 0741 05        	DCR	B
 0742 C23D07    	JNZ	MOVER
 0745 C9        	RET
                ;
                ;COMPARE ROUTINE (DE)<=>(HL), LENGTH IN B
                ;
 0746 1A        COMPR	LDAX	D
 0747 BE        	CMP	M
 0748 C0        	RNZ		;RET W/NON ZERO SET
 0749 13        	INX	D
 074A 23        	INX	H
 074B 05        	DCR	B
 074C C24607    	JNZ	COMPR
 074F C9        	RET		;ZERO SET, SHOWS =
                ;
                ;ALL DONE - WRITE EOF TO OUTPUT, RETURN
                ;
 0750 =         ALLDONE	EQU	$
 0750 3E1A      	MVI	A,'Z'-40H ;EOF CHAR
                	IF	NOT TEST
                	PUT	MASTOUT
 0752+CDD702    	CALL	PUTMASTOUT
                	FINIS	MASTOUT
 0755+2AD202    	LHLD	MASTOUTPTR
 0758+7D        	MOV	A,L
 0759+E67F      	ANI	(@SECT-1) AND 0FFH
 075B+C26107    	JNZ	??0035
 075E+22D002    	SHLD	MASTOUTLEN
 0761+3E1A      ??0035:	MVI	A,EOF
 0763+F5        	PUSH	PSW
 0764+CDD702    	CALL	PUTMASTOUT
 0767+F1        	POP	PSW
 0768+C25507    	JNZ	??0034
 076B+0E10      	MVI	C,@CLS
 076D+11AD02    	LXI	D,FCBMASTOUT
 0770+CD0500    	CALL	@BDOS
 0773+3C        	INR	A
 0774+C29907    	JNZ	??0037
 0777+0E09      	MVI	C,@MSG
 0779+118207    	LXI	D,??0036
 077C+CD0500    	CALL	@BDOS
 077F+C39907    	JMP	??0037
 0782+0D0A      ??0036:	DB	CR,LF
 0784+43414E4E4F	DB	'CANNOT CLOSE MASTOUT'
 0798+24        	DB	'$'
                	ENDIF
                ;
                ;RUN WAS SUCCESSFUL - SET FINAL FILE DISPOSITIONS
                ;
                	ERASE	BAK		;ERA CAT.BAK
 0799+0E13      	MVI	C,@DEL
 079B+11A603    	LXI	D,FCBBAK
 079E+CD0500    	CALL	@BDOS
                	ERASE	NAMES		;ERA NAMES.SUB
 07A1+0E13      	MVI	C,@DEL
 07A3+11DC01    	LXI	D,FCBNAMES
 07A6+CD0500    	CALL	@BDOS
                	RENAME	BAK,MASTIN	;REN MAST.BAK=MAST.CAT
 07A9+C3C007    	JMP	??0038
 07AC+E5        	PUSH	H
 07AD+011000    	LXI	B,16
 07B0+09        	DAD	B
 07B1+1A        ??0039:	LDAX	D
 07B2+77        	MOV	M,A
 07B3+13        	INX	D
 07B4+23        	INX	H
 07B5+0D        	DCR	C
 07B6+C2B107    	JNZ	??0039
 07B9+D1        	POP	D
 07BA+0E17      	MVI	C,@REN
 07BC+CD0500    	CALL	@BDOS
 07BF+C9        	RET
 07C0+210A01    	LXI	H,FCBMASTIN
 07C3+11A603    	LXI	D,FCBBAK
 07C6+CDAC07    	CALL	@RENS
                	RENAME	MASTIN,MASTOUT	;REN MAST.CAT=MAST.NEW
 07C9+21AD02    	LXI	H,FCBMASTOUT
 07CC+110A01    	LXI	D,FCBMASTIN
 07CF+CDAC07    	CALL	@RENS
 07D2 CDF007    	CALL	MSGXIT
 07D5 4D4153542E	DB	'MAST.CAT HAS '
 07E2 2020202020COUNT	DB	'     ENTRIES.$'
                ;
 07F0 D1        MSGXIT	POP	D	;GET MSG
 07F1 0E09      	MVI	C,@MSG
 07F3 CD0500    	CALL	@BDOS
 07F6 C30000    EXIT	JMP	$-$	;TO CP/M RETURN ADDR
 07F9           	DS	32H	;STACK SPACE
 082B =         STACK	EQU	$
 082B 00        NAEOFLG	DB	0	;NAME FILE EOF FLAG
 082C 00        MIEOFLG	DB	0	;MASTER IN EOF FLAG
 082D 5858585858NADAT	DB	'XXXXXXXX.YYY,'
                ;DKNAME	DB	'        .   '
 083A 2020202020DKNAME	DB	'        .'
 0843 202020    NEW	DB	'   '
 0846 5858585858MIDAT	DB	'XXXXXXXX.YYY,'
 0853 5858585858MIDSK	DB	'XXXXXXXX.YYY'
 085F 5858585858MODAT	DB	'XXXXXXXX.YYY,XXXXXXXX.YYY'
 0878 2424242020SUBNAME	DB	'$$$     .SUB'
                ;NAMES TO BE IGNORED READ IN HERE:
 0884 29        IGNORE	DB	')'	;DUMMY END OF TABLE
 0885           	DS	IGNSIZE
 0C85 =         BUFFERS	EQU	$
 4885 =         MEMSIZE	EQU	BUFFERS+@NXTB
